package top.shiyiri.shops.controller;

import com.alibaba.fastjson.JSONObject;
import top.shiyiri.shops.bean.TotalCount;
import top.shiyiri.shops.service.TotalCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author Aunean
 * @date 2021/12/21
 */
@Controller
public class TotalCountController {

    @Autowired
    private TotalCountService service;

    @RequestMapping("findTotalCount")
    @ResponseBody
    public String findTotalCount() {

        List<TotalCount> list = service.findTotalCount();

        String jsonStr = JSONObject.toJSONString(list);
//        System.out.println(jsonStr);
        return jsonStr;
    }
}
